Micron Document




Java Database Connectivity
part 11/17 · 28.8 KB total
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
String sql = "INSERT INTO emp1 VALUES ('pctb5361', 'kiril', 'john', 968666668)";
stmt.executeUpdate(sql);
System.out.println("Inserted records into the table...");
} catch (Exception e) {
e.printStackTrace();
}
}
}

JDBC drivers

JDBC drivers are client-side adapters (installed on the client machine, not on the server) that convert requests from Java programs to a protocol that the DBMS can understand.

Types

Commercial and free drivers provide connectivity to most relational-database servers. These drivers fall into one of the following types:

Type 1 that calls native code of the locally available ODBC driver. (Note: In JDBC 4.2, JDBC-ODBC bridge has been removedcite-ref-15[15])
Type 2 that calls database vendor native library on a client side. This code then talks to database over the network.
Type 3, the pure-java driver that talks with the server-side middleware that then talks to the database.
Type 4, the pure-java driver that uses database native protocol.

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────